/*
 *     Copyright 2000-2011 Francois de Bertrand de Beuvron
 * 
 *     This file is part of CoursBeuvron.
 * 
 *     CoursBeuvron is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     CoursBeuvron is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 * 
 *     You should have received a copy of the GNU General Public License
 *     along with CoursBeuvron.  If not, see <http://www.gnu.org/licenses/>.
 */
package fr.insa.beuvron.tps.m2.dessin2DV2;

import fr.insa.beuvron.tps.m2.dessin2DV3.*;
import java.util.ArrayList;

/**
 *
 * @author francois
 */
public class Triangle extends EnsembleFigure {

    public Triangle(Point p1, Point p2, Point p3) {
        super(pointVersSegments(p1, p2, p3));
    }

    public static ArrayList<Figure> pointVersSegments(Point p1, Point p2, Point p3) {
        ArrayList<Figure> res = new ArrayList<Figure>();
        res.add(new Segment(p1, p2));
        res.add(new Segment(p2, p3));
        res.add(new Segment(p3, p1));
        return res;
    }

    public String toString() {
        return "[Triangle]";
    }
    
    public static Triangle demande() {
        System.out.println("entrez le premier sommet du triangle : ");
        Point p1 = Point.demande();
        System.out.println("entrez le deuxième sommet du triangle : ");
        Point p2 = Point.demande();
        System.out.println("entrez le troisième sommet du triangle : ");
        Point p3 = Point.demande();
        return new Triangle(p1, p2, p3);
    }
}
